package com.dlc.beijingrfid.adapter;

import android.text.TextUtils;

import com.dlc.commonlibrary.adapter.BaseRecyclerAdapter;
import com.dlc.beijingrfid.R;
import com.dlc.beijingrfid.base.Constants;
import com.dlc.beijingrfid.net.bean.RFIDBean;

/**
 * Created by John on 2017/7/19.
 */

public class AbnormalAdapter<T extends RFIDBean.DataBean.ListBean> extends BaseRecyclerAdapter<T> {

    @Override
    public int getItemLayoutId(int viewType) {
        return R.layout.item_abnormal;
    }

    @Override
    public void onBindViewHolder(CommonHolder holder, int position) {
        T item = getItem(position);
        changeItemHeader(holder,item);
        holder.setText(R.id.tv_rfid,"FRID编号:"+item.getCardno());
        holder.setText(R.id.tv_productName,"产品名称:"+item.getTitle());
        holder.setText(R.id.tv_standard,"分类规格:"+item.getSpec());
        holder.setText(R.id.tv_abnormal,"查找不到");
    }

    private void changeItemHeader(CommonHolder holder,T item){
        if(item.getCategory_id() != null){
        switch (item.getCategory_id()) {
            case Constants.PRODUCT_TYPE.TOWEL:
                holder.setText(R.id.tv_type,"毛巾");
                break;
            case Constants.PRODUCT_TYPE.SHEET:
                holder.setText(R.id.tv_type,"床单");
                break;
            case Constants.PRODUCT_TYPE.BEDDING:
                holder.setText(R.id.tv_type,"被褥");
                break;
        }
        }
    }
}
